import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2024-05-07
 * Time: 16:38
 */
public class Main8 {
    static class Node {
        int index;
        int value;

        public Node(int index, int value) {
            this.index = index;
            this.value = value;
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        // 利用滑动窗口分别求出每个窗口的最大和最小值的和
        long bigSum = 0L;
        long smallSum = 0L;
        Deque<Node> bigDeque = new LinkedList<>();
        Deque<Node> smallDeque = new LinkedList<>();
        // 窗口初始化
        for (int i = 0; i < k - 1; i++) {
            // 维护大窗口
            while (!bigDeque.isEmpty()) {
                Node bigNode = bigDeque.peekLast();
                if (arr[i] > bigNode.value) {
                    bigDeque.removeLast();
                } else {
                    break;
                }
            }
            bigDeque.addLast(new Node(i, arr[i]));
            // 维护小窗口
            while (!smallDeque.isEmpty()) {
                Node smallNode = smallDeque.peekLast();
                if (arr[i] < smallNode.value) {
                    smallDeque.removeLast();
                } else {
                    break;
                }
            }
            smallDeque.addLast(new Node(i, arr[i]));
        }
        // 开始滑动窗口
        for (int i = k - 1; i < n; i++) {
            // 维护大窗口
            while (!bigDeque.isEmpty()) {
                Node bigNode = bigDeque.peekLast();
                if (arr[i] > bigNode.value) {
                    bigDeque.removeLast();
                } else {
                    break;
                }
            }
            bigDeque.addLast(new Node(i, arr[i]));
            // 维护小窗口
            while (!smallDeque.isEmpty()) {
                Node smallNode = smallDeque.peekLast();
                if (arr[i] < smallNode.value) {
                    smallDeque.removeLast();
                } else {
                    break;
                }
            }
            smallDeque.addLast(new Node(i, arr[i]));
            // 记录最大和最小值
            Node node1 = bigDeque.removeFirst();
            Node node2 = smallDeque.removeFirst();
            bigSum += node1.value;
            smallSum += node2.value;
            if (node1.index > i - k + 1) {
                bigDeque.addFirst(node1);
            }
            if (node2.index > i - k + 1) {
                smallDeque.addFirst(node2);
            }
        }
        // 输出结果
        double res = 1.0 * (bigSum - smallSum) / (n - k + 1);
        System.out.printf("%.2f", res);
    }
}
